define(function() {
    return ['$scope','$location', '$interval','$timeout','$routeParams','bizProxy', function($scope,$location,$interval,$timeout,$routeParams,bizProxy) {
    	$scope.$emit("top-show",'true');//显示顶部
    	$scope.$emit('menuTypeLight','mine'); 	//控制底部menu高亮
    	$scope.$emit('bub-menu','true'); 	//隐藏底部menu
    	$scope.$emit('flag-tag','67'); 	//显示底部文字
    	
    	//默认
    	$scope.isactive = false;
    	$scope.pwd = "";
    	
    	//点击确认
    	$scope.confirm = function(){
    		setLoginPwd();
    	}
    	
    	
    	//设置登录密码
    	function setLoginPwd(){
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;
            
            bizInfo.setupType = "loginPwd"; //设置用户登录密码
            bizInfo.newPwd = $scope.pwd;
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("setupUserInfo", headerInfo,bizInfo,
                    function(tempData){
            			$scope.$emit("loadingChange",false);
                        if(tempData.isSuccess == "T"){
                            $scope.$emit("promptAlertMsg","登录密码设置成功");
                            $scope.$emit("showCollect",true);
                            $timeout(function(){
                                $scope.$emit("showCollect",false);
                            },transData.promptTime);
            				$timeout(function(){
                                resultData.loginResultData.hasLoginPwd = "Y";
            					$location.path("/setLoginPwd").replace();//想改变当前 URL 而不创建新的历史记录的话
                                if(transData.userType === '1'){
                                    $scope.$emit("goNext","/mineLs");
                                }else{
                                    $scope.$emit("goNext","/minePt");
                                }
            				},1500);
                        }
                    },
                    function(data){
                    	$scope.$emit("loadingChange",false);
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                            $location.path("/setLoginPwd").replace();//想改变当前 URL 而不创建新的历史记录的话
                            $scope.$emit('goNext','/accountInfo');
                        },transData.promptTime);
                    }
            );
        }
    	
    	$scope.$watch('pwd', function() {
    		if(($scope.pwd).length > 5){
    			$scope.isactive = true;
    		}else{
    			$scope.isactive = false;
    		}
		});
    	
    	$scope.$apply();
    }];
});